package icu.cocoon.work.service.impl;

import icu.cocoon.dao.base.BaseService;
import icu.cocoon.work.entity.WeekReport;
import icu.cocoon.work.mapper.WeekReportMapper;
import icu.cocoon.work.service.WeekContentItemService;
import icu.cocoon.work.service.WeekNextItemService;
import icu.cocoon.work.service.WeekReportService;
import java.io.Serializable;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Cocoon
 * @since 2020-06-12
 */
@Service
public class WeekReportServiceImpl extends BaseService<WeekReportMapper, WeekReport> implements WeekReportService {

  @Resource
  private WeekContentItemService weekContentItemService;

  @Resource
  private WeekNextItemService weekNextItemService;

  @Transactional(rollbackFor = Exception.class)
  @Override
  public int removeById(Serializable id) {
    weekContentItemService.removeByWeekReportId((Long) id);
    weekNextItemService.removeByWeekReportId((Long) id);
    return super.removeById(id);
  }
}
